﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using LynxBlogAPI.Models.Mapping;

namespace LynxBlogAPI.Models
{
    public class LynxWebLog_Context : DbContext
    {
        static LynxWebLog_Context() 
        {
            Database.SetInitializer<LynxWebLog_Context>(null);
        }

        public LynxWebLog_Context() : base("Name=LynxWebLog_Context") { }

        public DbSet<BlogData> BlogDatas { get; set; }
        public DbSet<PostData> PostDatas { get; set; }
        public DbSet<CurrentPostData> CurrentPostDatas { get; set; }
        public DbSet<CategoryData> CategoryDatas { get; set; }
        public DbSet<PostCategory> PostCategories { get; set; }
        public DbSet<MediaObjectData> MediaObjectDatas { get; set; }
        public DbSet<PageData> PageDatas { get; set; }
        public DbSet<BlogLayoutData> BlogLayoutDatas { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new BlogDataMap());
            modelBuilder.Configurations.Add(new PostDataMap());
            modelBuilder.Configurations.Add(new CurrentPostDataMap());
            modelBuilder.Configurations.Add(new CategoryDataMap());
            modelBuilder.Configurations.Add(new PostCategoryMap());
            modelBuilder.Configurations.Add(new MediaObjectDataMap());
            modelBuilder.Configurations.Add(new PageDataMap());
            modelBuilder.Configurations.Add(new BlogLayoutDataMap());
        }

        public System.Data.Entity.DbSet<LynxBlogAPI.Models.CommentPolicy> CommentPolicies { get; set; }
    }
}